<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		/* 
			去除数组1[1,2,3,4,5]与数组2[1,3,5,7,9]中共同的元素 
		 */
		let array1 = [1, 2, 3, 4, 5];
		let array2 = [1, 3, 5, 7, 9];

		for (let i = 0; i < array1.length; i++) {
			let index = array2.indexOf(array1[i]);
			if (index != -1) {
				array1.splice(i, 1);
				array2.splice(index, 1);
				i--;
			}
		}
		console.log("数组1：",array1);
		console.log("数组2：",array2);
	</script>
</html>
